package unit5.part11;

public class Main {
    public static void main(String[] args) {
        Employee[] employees = new Employee[]{
                new Employee("1001", "ZhangSan", 6000f, "产品部"),
                new Employee("1002", "LiSi", 7000f, "技术部"),
                new Employee("1003", "WangWu", 4000f, "技术部"),
                new Employee("1004", "ZhaoLiu", 12000f, "技术部"),
                new Employee("1004", "QianQi", 8000f, "销售部"),
        };

        int num = 0;
        for (int i = 0; i < employees.length; i++) {
            if (!isRepeat(i, employees)) {
                System.out.println(employees[i]);
                num++;
            }
        }
        System.out.println("本公司有效员工数：" + num);
    }

    static boolean isRepeat(int index, Employee[] employees) {
        Employee now = employees[index];
        for (int i = 0; i < employees.length; i++) {
            if (index != i && now.equals(employees[i])) {
                return true;
            }
        }
        return false;
    }
}
